#!/bin/sh

mkdir -p <data_dir>/deploy_v3.0.3/data.pd/
mkdir -p <data_dir>/deploy_v3.0.3/log/

cd ~/TiExciting/tidb

if test -f "pid"; then
  echo "tidb-server running, kill pd..."
  kill -9 `cat pid`
  rm pid
fi

nohup ./tidb-server \
    -P <server_port> \
    --status="<status_port>" \
    --advertise-address="<server_ip>" \
    --path="<pd_cluster>" \
    --log-slow-query="<data_dir>/deploy_v3.0.3/log/tidb_slow_query.log" \
    --log-file="<data_dir>/deploy_v3.0.3/log/tidb.log" 2>> "<data_dir>/deploy_v3.0.3/log/tidb_stderr.log" & echo $! > pid
